﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DEService
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("---------------------------------");
            Console.WriteLine("请选择类别：");
        bz:
            Console.WriteLine("⑴加密请输入1;⑵解密请输入2;");
            Console.WriteLine("请输入并回车确认：");
            string typeStr = Console.ReadLine();
            string outputStr = "";
            if (typeStr == "1")
            {
                Console.WriteLine("请输入需要加密的字符并回车确认：");
                string inputStr = Console.ReadLine();
                outputStr = CommonLibrary.DESEncrypt.Encrypt(inputStr);
            }
            else if (typeStr == "2")
            {
                Console.WriteLine("请输入需要解密的字符并回车确认：");
                string inputStr = Console.ReadLine();
                outputStr = CommonLibrary.DESEncrypt.Decrypt(inputStr);
            }
            else
            {
                Console.WriteLine("请重新选择类别：");
                goto bz;
            }
            Console.WriteLine("结果为：{0}", outputStr);
            Console.WriteLine("------------------------------------------------");
            Console.WriteLine("请选择下一步操作：");
            Console.WriteLine("⑴重新选择类别请输入1；⑵退出请输入其它任意字符");
            Console.WriteLine("请输入并回车确认：");
            string o = Console.ReadLine();
            if (o == "1")
            {
                goto bz;
            }
        }
    }
}
